﻿using System;
using System.Collections.Generic;
using Jayden.Dll.Web.Enums;
using Jayden.Dll.Web.HtmlControls.Descriptions;
using Jayden.Dll.Web.HtmlControls.Generics;

namespace Jayden.Dll.Web.HtmlControls
{
	public class DataList : HtmlElement
	{
		public DataList() : base(DataListDescription.Instance) { }

		public Option AddOption() { return AddControl(new Option()) as Option; }
		public Option AddOption(string value, string text) { return AddControl(new Option(value, text)) as Option; }
		public Option AddOption(Option option) { return AddControl(option) as Option; }
	}
	public class DataListDescription : HtmlElementDescription
	{
		public static readonly DataListDescription Instance = new DataListDescription();
		private DataListDescription() : base("datalist", HtmlVersion.Html5, true, true) { }
		public override Type ControlType { get { return typeof(DataList); } }
		public override string Description { get { return "set of option elements that represent predefined options for other controls."; } }
		public override bool AllowInnerText { get { return true; } }
		public override IEnumerable<HtmlElementDescription> PermittedElements { get { yield return OptionDescription.Instance; } }
	}
}
